class Ex1
  
  def calculate(a, b, c)
    
    delta = b * b - 4 * a * c
    
    if (delta > 0) then
      begin
        x1 = -b + Math.sqrt(delta) / (2 * a)
        x2 = -b - Math.sqrt(delta) / (2 * a)
        printf("x1 = %.4f \n",x1)
        printf("x2 = %.4f",x2)
      end
      
    elsif (delta == 0)
      begin
        x = (-b + Math.sqrt(delta) / (2 * a))
        printf("x = %.4f",x)
      end
      
    else
      begin
        x1 = -b / (2 * a)
        y1 = Math.sqrt(-delta) / (2 * a)
        x2 = -b / (2 * a)
        y2 = -(Math.sqrt(-delta)) / (2 * a)
        printf("x1 = %.4f + %.4fi \n", x1, y1)
        printf("x2 = %.4f + %.4fi ", x2, y2)
      end
    end 
      
  end
  
end

  puts "Nhap a,b,c nguyen:"
  a = gets.chomp.to_i
  b = gets.chomp.to_i
  c = gets.chomp.to_i
  ex1 = Ex1.new()
  ex1.calculate(a,b,c)